package com.example.yam.greenapp;

import org.json.JSONException;
import org.json.JSONObject;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

/**
 * Created by 杨建利on 2017/1/30.
 */

public class User {
    private String id;
    private String name;
    private String pic;
    private String location;
    private String phone;
    User(String id,String name,String pic,String location,String phone){
        this.id=id;
        this.name=name;
        this.pic=pic;
        this.location=location;
        this.phone=phone;
    }

    public String getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public String getLocation() {
        return location;
    }

    public String getPhone() {
        return phone;
    }

    public String getPic() {
        return pic;
    }

    public String getJsonObject(){
        String ss=null;
        JSONObject jb = new JSONObject();

        try {
            jb.put("name", URLEncoder.encode(this.getName(),"utf-8"));
            jb.put("id",this.getId());
        } catch (JSONException e) {
            e.printStackTrace();
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }

        ss = jb.toString();
        return ss;
    }
}
